package com.geek.novel.entity

import com.geek.novel.utils.SnowIdUtil
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import io.realm.annotations.RealmClass
import java.util.*

/**
 * 阅读章节
 */
@RealmClass
open class BookIndex : RealmObject() {
	
	@PrimaryKey
	open var id: Long? = null
	
	/**
	 * 书籍ID
	 */
	open var bookId: String? = null
	
	/**
	 * 章节ID，为空表示还未爬取内容
	 */
	open var sectionId: String? = null
	
	/**
	 * 章节的序号，注意不是递增的，可能会跳号
	 */
	open var indexNum: Int? = null
	
	/**
	 * 章节的名称
	 */
	open var indexName: String? = null
	
	/**
	 * 章节的字数
	 */
	open var wordCount: Int? = null
	
	/**
	 * 章节的url，用于获取内容
	 */
	open var sectionUrl: String? = null
	
	/**
	 * 用于标志章节是否爬取完毕
	 */
	open var crawler: Boolean? = null



	/**书籍爬虫源的信息*/
	open var bookCrawlerId: String? = null

	
	fun initEntity(){
		this.id = SnowIdUtil.getInstance().nextId()
	}
	
}